package cn.edu.scnu.socialapp.controller;

import cn.edu.scnu.socialapp.service.CommentsService;
import cn.edu.scnu.socialapp.model.vo.Result;
import cn.edu.scnu.socialapp.model.vo.params.CommentParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("comments")
public class CommentsController {

    @Autowired
    private CommentsService commentsService;

    @GetMapping("/article/{id}")
    public Result getCommentsByArticleId(@PathVariable("id") Long articleId) {
        return commentsService.commentsByArticleId(articleId);
    }

    @PostMapping("/create/change")
    public Result comment(@RequestBody CommentParams commentParams) {
        return commentsService.comment(commentParams);
    }

}

